/*
 Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 SPDX-License-Identifier: Apache-2.0
*/

@use 'sass:map';
@use '../internal/styles' as styles;
@use '../internal/styles/tokens' as awsui;

@use './motion';

$_status-colors: (
  'error': awsui.$color-text-status-error,
  'warning': awsui.$color-text-status-warning,
  'success': awsui.$color-text-status-success,
  'info': awsui.$color-text-status-info,
  'stopped': awsui.$color-text-status-inactive,
  'pending': awsui.$color-text-status-inactive,
  'in-progress': awsui.$color-text-status-inactive,
  'loading': awsui.$color-text-status-inactive,
  'not-started': awsui.$color-text-status-inactive,
);

$_color-overrides: (
  'red': awsui.$color-text-status-error,
  'grey': awsui.$color-text-status-inactive,
  'blue': awsui.$color-text-status-info,
  'green': awsui.$color-text-status-success,
  'yellow': awsui.$color-text-status-warning,
);

.root {
  @include styles.default-text-style;
  @each $status in map.keys($_status-colors) {
    &.status-#{$status} {
      color: #{map.get($_status-colors, $status)};
    }
  }
  @each $color in map.keys($_color-overrides) {
    &.color-override-#{$color} {
      color: #{map.get($_color-overrides, $color)};
    }
  }
}

.container {
  &.display-inline {
    @include styles.text-wrapping;
    display: inline;

    > .icon {
      white-space: nowrap;
    }
  }

  &.display-inline-block {
    display: inline-block;
    word-wrap: break-word;
    word-break: break-all;

    > .icon {
      padding-inline-end: awsui.$space-xxs;
    }
  }
}

.overflow-ellipsis {
  max-inline-size: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: text-bottom;
}
